home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1998 June / SGI IRIX 6.5 Applications 1998 June.iso / dist / arraysvcs.idb / usr / lib / array / ampi.z / ampi
Text File  |  1998-04-15  |  1KB  |  69 lines

  1. #!/bin/ksh
  2. #
  3. # Simple script to fire up the MPI launcher
  4. #
  5.  
  6. Launcher=/usr/bin/xmpi
  7. Usage="ampi <origin> <display> <cwd> <array name> [<envvar> <value>]..."
  8.  
  9. #
  10. # Make sure enough args were specified
  11. #
  12. if [ "$#" -lt 4 ]; then
  13.     echo "Incorrect number of arguments to $0"
  14.     echo $Usage
  15.     exit 1
  16. fi
  17.  
  18. #
  19. # Give command line args more meaningful names
  20. #
  21. Origin=$1
  22. DISPLAY=$2
  23. Cwd=$3
  24. MPI_ARRAY=$4
  25. shift 4
  26.  
  27. #
  28. # Set some relevant environment variables that xwsh doesn't handle
  29. #
  30. eval HOME=~$LOGNAME
  31. export DISPLAY HOME MPI_ARRAY
  32.  
  33. #
  34. # Set any caller-specified environment variables
  35. #
  36. while [ $# -gt 1 ]; do
  37.     VarName=$1
  38.     VarValue=$2
  39.  
  40.     if [ "$VarName" = "MPIRUN_DIR"  -a  "$VarValue" = "." ]; then
  41.         if [ "$Cwd" != "<>" ]; then
  42.             VarValue=$Cwd
  43.         fi
  44.     fi
  45.  
  46.     eval "export $VarName="'"'$VarValue'"'
  47.     shift 2
  48. done
  49.  
  50. #
  51. # If MPIview is not installed, quit now
  52. #
  53. if [ ! -x $Launcher ]; then
  54.     /usr/bin/X11/xconfirm             \
  55.         -c                \
  56.         -header "Launch MPI Job"    \
  57.         -t "Sorry, the MPI job launcher $Launcher is not installed" \
  58.         -icon error            \
  59.         > /dev/null
  60.     exit 1
  61. fi
  62.  
  63. #
  64. # Invoke xmpi
  65. #
  66. exec $Launcher
  67.  
  68. exit 99     # "Shouldn't" make it to here
  69.